<template>

  <div class="index">
    <van-grid :column-num="3">
      <van-grid-item
        v-for="(item,index) in items"
        :key="index"
        :icon="item.icon"
        :text="item.text"
        :class="item.color"
        msg-text="item.text"
        @click="checkLink(index)"
      />
    </van-grid>
    
  </div>
</template>

<script>
import { getCookie,setCookie } from './until';
export default {
  name: 'index',
  data () {
    return {
      items:[
        {text:'运营数据',icon:'todo-list',color:'default'},
        {text:'红包运营数据',icon:'balance-list',color:'primary'},
        {text:'新增用户数据',icon:'card',color:'info'},
        {text:'推广数据',icon:'bill',color:'warning'},
        {text:'财务模型报表',icon:'expand',color:'danger'}
      ],
      link: '/list/:id'
    }
  },
  created () {
    if(!getCookie("userid") || !getCookie("token")){
      setCookie('token','',-1)
      setCookie('userid','',-1)
      window.location.href='/'
    }
    
  },
  methods: {
    checkLink(index){
      this.$router.push({path:`/list${index}`})
    }
  } 
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.index{margin-top: 80px;}
.default{color: #dc69aa}
.primary{color: #409eff}
.info{color: #67c23a}
.warning{color: #e6a23c}
.danger{color: #f56c6c}
</style>
